package com.ray.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.ray.bean.WarehouseOutPrintTemplateBean;
import com.ray.mapper.WarehouseOutPrintTemplateMapper;

/**
 * 
* <p>Title: WarehouseOutPrintTemplateService</p>  
* <p>Description: </p>  
* @author 李斌  
* @date 2018年9月17日
 */
@Service
public class WarehouseOutPrintTemplateService {
	
	@Autowired
	WarehouseOutPrintTemplateMapper warehouseOutPrintTemplateMapper;

	public List<WarehouseOutPrintTemplateBean> getWarehouseOutPrintTemplate(Map<String, String> map) {
		List<WarehouseOutPrintTemplateBean> warehoueOutPrintTemplateBeans = warehouseOutPrintTemplateMapper.getWarehouseOutPrintTemplate(map);
		return warehoueOutPrintTemplateBeans;
	}

	public void addWarehouseOutPrintTemplate(Map<String, String> map) {
		List<WarehouseOutPrintTemplateBean> printDataTemplateList =  this.getWarehouseOutPrintTemplate(map);
		Assert.isTrue(printDataTemplateList==null || printDataTemplateList.size()<1, "改类型模板已经存在");
		int row = warehouseOutPrintTemplateMapper.addWarehouseOutPrintTemplate(map);
		Assert.isTrue(row>0, "添加模板失败");
	}
}
